﻿using System;
using Newtonsoft.Json;

namespace CuteRibs.WowArmory.Models
{
	#region CompletedAchievements
	/// <summary>
	/// {
	///		"achievementsCompleted": [],
	///		"achievementsCompletedTimestamp": [],
	///		"criteria": [],
	///		"criteriaQuantity": [],
	///		"criteriaTimestamp": [],
	///		"criteriaCreated": []
	///	}
	/// </summary>
	[JsonObject]
	public class CompletedAchievements
	{
		[JsonProperty("achievementsCompleted")]
		public int[] AchievementsCompleted { get; set; }

		[JsonProperty("achievementsCompletedTimestamp")]
		[JsonConverter(typeof(BNDateTimeConverter))]
		public DateTime[] AchievementsCompletedTimestamp { get; set; }

		[JsonProperty("criteria")]
		public int[] Criteria { get; set; }

		[JsonProperty("criteriaQuantity")]
		public long[] CriteriaQuantity { get; set; }

		[JsonProperty("criteriaTimestamp")]
		[JsonConverter(typeof(BNDateTimeConverter))]
		public DateTime[] CriteriaTimestamp { get; set; }

		[JsonProperty("criteriaCreated")]
		[JsonConverter(typeof(BNDateTimeConverter))]
		public DateTime[] CriteriaCreated { get; set; }
	}
	#endregion

	#region Achievements
	/// <summary>
	///	{
	///		"achievements": []
	///	}
	/// </summary>
	[JsonObject]
	public class Achievements
	{
		[JsonProperty("achievements")]
		public AchievementCatalog[] Catalogs { get; set; }
	}
	#endregion

	#region AchievementCatalog
	/// <summary>
	/// {
	///		"id": 168,
	///		"categories": [],
	///		"achievements": [],
	///		"charName": "Dungeons & Raids"
	///	}
	/// </summary>
	[JsonObject]
	public class AchievementCatalog
	{
		[JsonProperty("id")]
		public int Id { get; set; }

		[JsonProperty("categories")]
		public AchievementCategory[] Categories { get; set; }

		[JsonProperty("achievements")]
		public Achievement[] Achievements { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }
	}
	#endregion

	#region AchievementCategory
	/// <summary>
	/// {
	///		"id": 14808,
	///		"achievements": [],
	///		"charName": "Classic"
	///	}
	/// </summary>
	[JsonObject]
	public class AchievementCategory
	{
		[JsonProperty("id")]
		public int Id { get; set; }

		[JsonProperty("achievements")]
		public Achievement[] Achievements { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }
	}
	#endregion

	#region Achievement
	/// <summary>
	///	{
	///		"id": 5158,
	///		"title": "Stay Classy",
	///		"points": 10,
	///		"description": "Complete the classy achievements listed below.",
	///		"reward": "Reward: Guild Vault Voucher (8th Tab)",
	///		"rewardItems": [],
	///		"icon": "achievement_general_stayclassy",
	///		"criteria": [],
	///		"accountWide": false
	///	}
	/// </summary>
	[JsonObject]
	public class Achievement : BNObjectBase
	{
		[JsonProperty("id")]
		public int Id { get; set; }

		[JsonProperty("title")]
		public string Title { get; set; }

		[JsonProperty("points")]
		public int Points { get; set; }

		[JsonProperty("description")]
		public string Description { get; set; }

		[JsonProperty("reward")]
		public string Reward { get; set; }

		[JsonProperty("rewardItems")]
		public Item[] RewardItems { get; set; }

		[JsonProperty("icon")]
		public string Icon { get; set; }

		[JsonProperty("criteria")]
		public Criteria[] Criteria { get; set; }

		[JsonProperty("accountWide")]
		public bool AccountWide { get; set; }
	}
	#endregion

	#region Criteria
	/// <summary>
	/// {
	///		"id": 18549,
	///		"description": "不眠的约萨希（10人普通）",
	///		"orderIndex": 1,
	///		"max": 1
	///	}
	/// </summary>
	[JsonObject]
	public class Criteria
	{
		[JsonProperty("id")]
		public int Id { get; set; }

		[JsonProperty("description")]
		public string Description { get; set; }

		[JsonProperty("orderIndex")]
		public int OrderIndex { get; set; }

		[JsonProperty("max")]
		public int Max { get; set; }
	}
	#endregion
}
